package lab02.test06;

import java.util.Scanner;

public class Test_Shape {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);



        while (true) {

            System.out.println("1.三角形" + "\n" + "2.梯形" + "\n" + "3.圆形"+"\n"+"4.退出");
            System.out.println("请选择图形：");

            int n = sc.nextInt();
            switch (n) {
                case 1:
                    System.out.println("请输入三角形三边长：");
                    double a = sc.nextDouble();
                    double b = sc.nextDouble();
                    double c = sc.nextDouble();

                    Triangle sb = new Triangle();

                    if (sb.isTemp(a, b, c)) {

                        System.out.println("三角形面积为：" + sb.getArea(a, b, c));
                        System.out.println("三角形周长为：" + sb.getPerimeter(a, b, c));

                    }
                    break;

                case 2:
                    System.out.println("请输入梯形的上底，下底和高：");
                    double up = sc.nextDouble();
                    double down = sc.nextDouble();
                    double high = sc.nextDouble();

                    Ladder sp = new Ladder();
                    System.out.println("梯形面积为：" + sp.getArea(up, down, high));

                    break;

                case 3:
                    System.out.println("请输入圆形半径：");
                    double radius = sc.nextDouble();

                    Circle sr = new Circle();
                    System.out.println("圆形周长为：" + sr.getPerimeter(radius) + "\n" + "圆形面积为：" + sr.getArea(radius));
                    break;

                case 4:
                    return;
            }

        }
    }
}
